<?php

namespace app\admin\controller;

use app\BaseController;
use think\facade\Db; // 数据库的链接

class Proposal extends BaseController
{
    // 获取意见反馈列表
    public function getlist()
    {
        $get = input();

        // 分页
        $pageSize = $get['pageSize'] > 100 ? 100 : $get['pageSize'];
        $page = $get['pageNo'];
       
        
        // 查询条件 模糊查询
        if (!empty(@$get['title'])) {
            $sql[] = ['content', 'LIKE', "%" . $get['title'] . "%"];
        }
        

        // 使用table分页查询数据表wechart_customer_info
        $list = Db::name('proposal')
            ->field("*, FROM_UNIXTIME(addto_time,'%Y-%m-%d %H:%i:%s') as addto_time")
            ->where(@$sql)
            ->paginate([
                'list_rows' => $pageSize,
                'page' => $page
            ])
            ->toArray();

        
        // 返回数据
        return array(
            'code' => 200,
            'msg' => 'success',
            'data' => $list,
        );
    }
}